package com.jeesite.modules.kj.api.vo.response;

import com.jeesite.common.lang.StringUtils;
import com.jeesite.modules.kj.entity.KjMember;
import com.jeesite.modules.kj.utils.IntegralUtil;
import com.jeesite.modules.kj.utils.SkillUtil;
import com.jeesite.modules.sys.utils.DictUtils;
import com.twelvemonkeys.lang.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.math.BigDecimal;

@Data
public class MemberInfoResponseVo {

    @ApiModelProperty(value = "用户ID")
    private String id;
    @ApiModelProperty(value = "用户名")
    private String name;
    @ApiModelProperty(value = "手机号码")
    private String mobile;
    @ApiModelProperty(value = "生日")
    private String birthday;		// birthday
    @ApiModelProperty(value = "用户类型 0为非中兴员工 1为中兴员工")
    private String memberType;		// member_type
    @ApiModelProperty(value = "常住地")
    private String address;		// address
    @ApiModelProperty(value = "中兴员工号")
    private String memberNo;		// 会员卡号
    @ApiModelProperty(value = "头像")
    private String headimg;		// headimg
    @ApiModelProperty(value = "政府志愿者编号")
    private String volunteerNo;

    @ApiModelProperty(value = "邮箱")
    private String email;

    @ApiModelProperty(value = "证件类型")
    private String documentType;
    @ApiModelProperty(value = "身份证号")
    private String idcard;

    @ApiModelProperty(value = "特长")
    private String skill;
    @ApiModelProperty(value = "特长字符串")
    private String skillStr;

    @ApiModelProperty(value = "志愿者编号")
    private String foundationNo;


    @ApiModelProperty(value = "总工时")
    private BigDecimal totalHours;
    public MemberInfoResponseVo() {
    }

    public MemberInfoResponseVo(KjMember kjMember) {
        BeanUtils.copyProperties(kjMember, this);
        if(StringUtils.isNotBlank(this.skill)){
            this.skillStr = SkillUtil.getSkills(this.skill);
        }
        if(StringUtils.isNotBlank(this.documentType)){
            this.documentType = DictUtils.getDictLabel("document_type", this.documentType, "居民身份证");
        }
        this.totalHours = IntegralUtil.getMemberHours(kjMember);
    }
}
